package com.molichuxing.property;

/**
 * 邮件标题枚举
 * @author liuruifeng
 */
public enum EmailSubjectEnum {

	/**
	 *采购订单还款日前3天触发
	 */
	PURCHASE_ORDER_REPAYMENT_DATE_REMINDER (1, "订单【${orderCode}】未还款预警"),

	/**
	 *采购订单还款逾期一天触发
	 */
	PURCHASE_ORDER_REPAYMENT_OVERDUE_REMINDER (2, "订单【${orderCode}】未还款预警")
	;




	int value;
	String name;

	EmailSubjectEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}


	/**
	 * 通过value获取枚举的name
	 * 
	 * @param value
	 * @return
	 */
	public static String getName(int value) {
		EmailSubjectEnum enumerate = getEnum(value);
		return enumerate == null ? null : enumerate.getName();
	}

	/**
	 * 通过value获取枚举
	 * 
	 * @param value
	 * @return
	 */
	public static EmailSubjectEnum getEnum(int value) {
		for (EmailSubjectEnum enumerate : EmailSubjectEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate;
			}
		}
		return null;
	}
}
